def calculate_area(s1, s2, reference_point):
    """ 计算两点与参考点形成的面积 """
    x1, y1 = s1
    x2, y2 = s2
    xR, yR = reference_point

    return abs(x2 - x1) * abs(yR - min(y1, y2))

def calculate_area_special_case(s1, s3, reference_point):
    """ 计算特殊情况下的面积 """
    x1, y1 = s1
    x3, y3 = s3
    xR, yR = reference_point

    return abs(xR - x1) * abs(yR - y1) - abs(xR - x3) * abs(yR - y3)

# 给定的坐标点
s1 = (1, 6)
s2 = (2, 5)
s3 = (3, 7)
reference_point = (10, 10)

# 计算面积
area_s1_s2 = calculate_area(s1, s2, reference_point)
area_s1_s3 = calculate_area_special_case(s1, s3, reference_point)

print(area_s1_s2)
print(area_s1_s3)

